package top.wilbert.collegelink.positionresume.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import top.wilbert.collegelink.positionresume.dao.PositionDao;
import top.wilbert.collegelink.positionresume.entity.PositionEntity;
import top.wilbert.collegelink.positionresume.service.PositionService;
import top.wilbert.collegelink.common.utils.PageUtils;
import top.wilbert.collegelink.common.utils.Query;
import top.wilbert.collegelink.positionresume.vo.PositionInfoVo;

import java.util.List;
import java.util.Map;


@Service("positionService")
public class PositionServiceImpl extends ServiceImpl<PositionDao, PositionEntity> implements PositionService {
    @Autowired
    private PositionDao positionDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<PositionEntity> page = this.page(
                new Query<PositionEntity>().getPage(params),
                new QueryWrapper<PositionEntity>()
        );

        return new PageUtils(page);
    }


    @Override
    public List<PositionInfoVo> queryPage(Map<String, Object> params, PositionEntity position, String key) {
        List<PositionInfoVo> list = positionDao.listByQueryOrFuzzy(params, position, key);

        return list;
    }

}